/*
 * RtpPacker.h
 *
 *  Created on: 2018年4月21日
 *      Author: chuanjiang.zh@qq.com
 */

#ifndef RTPPACKER_H_
#define RTPPACKER_H_

#include "MediaType.h"
#include "MediaPacket.h"
#include "MediaFormat.h"
#include <functional>
#include "RtpType.h"

namespace av
{


typedef std::function<void (RtpPacket&)> 	RtpPackerSink;


class RtpPacker
{
public:
	RtpPacker():
		m_payload()
	{
	}

	virtual ~RtpPacker() {}

	virtual bool open() =0;

	virtual void pack(const MediaPacket& pkt, int maxSize, RtpPackerSink sink) =0;

	virtual void close() =0;

	virtual void setPayload(int payload)
	{
		m_payload = payload;
	}

protected:
	int	m_payload;
};


class RtpUnPacker
{
public:
	virtual ~RtpUnPacker() {}

	virtual bool open(int mediaType, int codec) =0;

	virtual bool unpack(RtpPacket& pktIn, MediaPacket& pktOut) =0;

	virtual void close() =0;

	virtual bool getFormat(MediaFormat& format) =0;

};




} /* namespace av */

#endif /* RTPPACKER_H_ */
